<?php
header("Content-type:text/html;charset=utf-8");

require_once './controllers/IndexController.php';
require_once 'MySmarty.php';
require_once 'PageList.class.php';


@$cur_page = $_GET['cur_page'];

if(!isset($cur_page))
{
	$cur_page=1;
}


$smarty = new MySmarty();

session_start();
if(!isset($_SESSION['index_items']))
{
	$index  = new IndexController();
	$all_items=$index->indexAction();
	$_SESSION['index_items']=$all_items;
}
else
{
	$all_items = $_SESSION['index_items'];
}

$page_list = new PageList($cur_page,$all_items);
$cur_items = $page_list->returnItems();
$page_menu = $page_list->returnPageMenu();
$smarty->assign('menus',$page_menu);
$smarty->assign('books',$cur_items);

$smarty->display('index.html');

?>